<!DOCTYPE html>
<html>
<head>
    <title>箱子管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="/css/bootstrap-responsive.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" type="text/css" href="/css/style.css">
    <script src="/lib/jq/jquery-2.1.1.min.js"></script>
    <script src="/lib/jq/bootstrap.min.js"></script>
</head>
<body style="margin:15px;">
<div id="lert"></div>
<% if (success) { %>
<div class="alert alert-success">
    <h4><%= success %></h4>
</div>
<% } %>
<% if (error) { %>
<div class="alert alert-error">
    <h4><%= error %></h4>
</div>
<% } %>
<legend>绑定商品</legend>
<form onsubmit="return check()" style="margin-left: 25%" action="/box_management/Binding" method="post" name="form1" class="form-horizontal">

    <div class="control-group">
        <label class="control-label">商品：</label>
        <div class="controls">
            <select name="prize" id="prize">
                <option value="0">请选择商品</option>
                <%for(var i=0;i<datas.length;i++){%>
                <option value="<%=datas[i]._id%>"><%=datas[i].name%></option>
                <%}%>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">活动价格：</label>
        <div class="controls">
            <input type="text" id="discount_price" name="discount_price" />
            <input type="text" id="boxid" name="boxid" value="<%=boxid%>" style="display: none" />
            <input type="text" id="index" name="index" value="<%=index%>" style="display: none" />
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <input type="submit" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" value="提交" id="sub_btn">
        </div>
    </div>
</form>
<script>
    function check(){
        var imgurl=$('#discount_price').val();
        var prize=$('#prize').val();
        if(imgurl==''||prize=='0'){
            $('#lert').html("<div class='alert alert-error'><h4>请完善资料.</h4></div>");
            return false;
        }else{
            return true;
        }

    }

</script>
</body>
</html>